
/**
 * 角色方法接口文件
 */
import request from './request'

export const getRoles = ()=> request.get('roles');
/**
 * @description 删除标签
 * @param {Number} roleId 角色id 
 * @param {Number} tagId  标签id
 * @returns 
 */
export const deleteTag = (roleId,tagId)=> request.delete(`roles/${roleId}/rights/${tagId}`)
/**
 * @description  添加角色
 * @param {Object} model  添加的角色信息
 * @returns 
 */
export const addRole = (model)=> request.post('roles',model);
/**
 * 
 * @method
 * @description 修改角色
 * @param {Object} model 要修改的角色信息
 * @returns 
 */
export const updateRole = (model)=> request.put(`roles/${model.id}`,model);

/**
 * @method
 * @description 删除角色
 * @param {Number} id 删除的角色id 
 * @returns 
 */
export const deleteRole = (id)=>request.delete(`roles/${id}`);

/**
 * 
 * @method
 * @description 获取权限列表
 */
export const getRightsList = ()=>request.get(`rights/tree`);
/**
 * @method
 * @description获取权限列表
 * @returns 
 */
 export const getRights=()=>request.get(`rights/list`)
/**
 * @method 
 * @description 更新权限
 * @param {Number} roleId 角色Id
 * @param {String} rids 权限Id
 * @returns 
 */
 export const updateRights=(roleId,rids)=>request.post(`roles/${roleId}/rights`,{rids})